I have recentely been experiencing an array of emotions due to school starting, leaving home and saying goodby to people, seeing my school friends again. As a result, I am very susceptible to the level of emotions in the music i listen to.
I wanted to see if there is a way to determine which genre of songs will keep me at a constant mood(whether happy or sad) and which songs will take me on even more of an emotional rollercoaster.
This notebook runs R in python using reticulate, so we need to install reticulate first. Then we install all the necessary python packages for the assignment. The code has been ommitted for the sake of presentation The packages used were: * nltk(Python NLP library) * pandas * wordcloud * matplotlib
In this part, I parsed the lyrics using various python nltk methods all of which are commented in the code. The result was a dataframe on which analysis can be performed
I wanted to see whether the most frequent words in a genre would allow us to establish what song is the most emotive.
## (-0.5, 399.5, 199.5, -0.5)
##### Word cloud for Pop music
## (-0.5, 399.5, 199.5, -0.5)
## (-0.5, 399.5, 199.5, -0.5)
Because the wordclouds are ovwerwhelmed by the most frequant song words like “love”, I decided to use sentiment analysis to determine the positivity or negativity of a song.
I also wanted to take time into account and answer the question: have some genres become more happy over the years while others became more grim? Below is some of the output.All the songs maximum happiness has been plotted on the same graph
The Scores shown were obtained by: getting the max polarity score(swhat is the highest score gitten by a line in the song) per song and just averaging those per genre.
This doesn’t really tell you what to listen to based on your mood because they have relatively similar positivity levels
So I decided to delve further into this theme of emotiveness to see which genres can be considered as having the largest range of emotions expressed. The graphs below show both the max polarity of the song by genre and the min polarity over the years for a couple of genres.
The bigger the difference, the larger the range of emotions a song’s lines display(large difference between most happy line and most sad line)
All genres seemed to take a dip in terms of their happiness score at the turn of the millenium. This would be an interesting angle to investigate given other data like economic data and news data.But after 2000 most songs seem to have constant levels of happiness scores
We see especially from the last set of graphs that the most emotive genre is Hip-Hop. You should listen to this when you are not feeling too many emotions at once so that the songs don’t take you on a ride.
If however, you are experiencing a range of emotions at once and you want something consistent, the data recommends listening to R&B. I know right! Surprising! But I didn’t say quiet, I just said least range of emotions. The song will either be really sad or really happy.